package com.woniu.user.controller;


import com.woniu.entity.Result;
import com.woniu.user.pojo.dto.CommentDTO;
import com.woniu.user.service.ICommentService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 评论表 前端控制器
 * </p>
 *
 * @author LiFangyu
 * @since 2023-02-15
 */
@RestController
@RequestMapping("/comment")
public class CommentController {

    @Autowired
    private ICommentService commentService;

    @PostMapping("/addComment")
    @ApiOperation("添加评论")
    public Result addComment(@RequestBody CommentDTO commentDTO){
        return  commentService.addComment(commentDTO);
    }

    @GetMapping("getComment/{articleId}")
    @ApiOperation("查询评论")
    public Result getComment(@PathVariable String articleId){
        return  commentService.getComment(articleId);
    }
}
